<template>
  <!-- 查看库存明细 -->
  <div>
    <FilterTable
      ref="table"
      columnsRef="part_report_salessettlement_partBillDetail"
      :dataSource="dataList"
      :isMemoryPagination="true"
      :isSelectColumn="false"
      :columns="tableColumns"
      :datakey="'rows'"
      :onColumnsChange="columns => (this.tableColumns = columns)"
      :params="fetchParams"
      :fetchapi="fetchApi"
    >
      <!-- <template slot="controls">
        <el-button size="small" type="primary">导出</el-button>
        <el-button size="small" type="primary">打印</el-button>
      </template>-->
    </FilterTable>
    <div class="bottomBtnWrap">
      <el-button @click="handleClose">关 闭</el-button>
      <!-- <el-button @click="handleConfirm" type="primary">确 定</el-button> -->
    </div>
  </div>
</template>

<script>
import { quertR3Log, queryAllOrderTypeInfo } from '@/api/part/partPurchase/purchaseOrder';
import { getItemDetailList } from '@/api/part/report/salessettlement';
import { dictionary } from '@/utils/dictMixin';
export default {
  mixins: [dictionary],
  props: {
    roNo: {
      type: String
    }
  },
  data() {
    return {
      fetchApi: getItemDetailList,
      fetchParams: { xhrAbort: true },
      tableColumns: this.createTableColumns(),
      // orderTypeList: {}, //所有订单类型(翻译用)
      dataList: [] // 日志列表
    };
  },
  created() {
    this.queryPartBillDetailList();
  },
  // mounted() {
  //   // this.$nextTick(() => {
  //   this.queryPartBillDetailList();
  //   // this.queryAllOrderTypeInfoList();
  //   // });
  // },
  methods: {
    createTableColumns() {
      return [
        {
          title: '收款金额',
          dataIndex: 'REAL_TOTAL_AMOUNT',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '收款类型',
          dataIndex: 'PAY_TYPE_CODE',
          sorter: true,
          filter: true,
          filterType: 'check',
          dictItems: this.createDictList('8092'),
          render: props => {
            return <span>{this.createDictText(props.row.PAY_TYPE_CODE, '8044')}</span>;
          }
        },
        {
          title: '备注',
          dataIndex: 'REMARK',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    },
    // 查询所有订单类型
    async queryAllOrderTypeInfoList() {
      let res = await queryAllOrderTypeInfo();
      let obj = {};
      res.data.map(item => {
        obj[item.partTypeNo] = item.partTypeName;
      });
      this.orderTypeList = obj;
    },
    // 查询r3列表
    async queryPartBillDetailList() {
      var roNo = this.roNo;
      // console.log('partBill NO' + roNo);
      this.fetchParams.xhrAbort = true;
      this.fetchParams = Object.assign({}, { roNo }, { xhrAbort: false });
    },
    handleClose() {
      this.$emit('close');
    }
  }
};
</script>

<style scoped>
.bottomBtnWrap {
  position: absolute;
  left: 0px;
  bottom: 0px;
  right: 0px;
  z-index: 9;
  border-top: 1px solid rgb(233, 233, 233);
  padding: 10px 20px;
  background: rgb(255, 255, 255);
  text-align: right;
}
.btnWrap {
  position: absolute;
  left: 0px;
  bottom: 0px;
  right: 0px;
  z-index: 9;
  border-top: 1px solid rgb(233, 233, 233);
  padding: 10px 20px;
  background: rgb(255, 255, 255);
  text-align: right;
}
</style>
